﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="UI.test" %>
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">

    <script type="text/javascript" src="/js/common.js"></script>
    <style>

    </style>
</head>
<body>
    <form runat="server">
    <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
    </form>
    <div id="iframe" style='width:100%;height:100%;'>
        <iframe src="http://a3.rabbitpre.com/m/zNQeE3VBO" frameborder="0" style="width:100%; height:100%;"></iframe>
    </div>
    <script>
        $("#city5").picker({
            title: "请选择您的手机",
            cols: [
    {
        textAlign: 'center',
        values: ['iPhone 4', 'iPhone 4S', 'iPhone 5', 'iPhone 5S', 'iPhone 6', 'iPhone 6 Plus', 'iPad 2', 'iPad Retina', 'iPad Air', 'iPad mini', 'iPad mini 2', 'iPad mini 3']
    }
  ]
        });
function shows() {
    var data = {};
    data.userid = 1;
    data.openid = 1;
    data.allmoney = 0.01;
    data.flag = "charge";
    data.act = "GetH5WxPara";
    $.showLoading("正在调起支付...");
    Ajax.Post("/tools/API.ashx", data, function (r) {
        var json = $.parseJSON(r);
        if (json.state) {
            if (isWeiXin) {
                
            } else {
                testApp("https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=" + json.data.prepay_id + "&package=" + json.data.package + "&redirect_url=" + unescape("http://yxk.hpbfnsmh.cn/paysuccess.aspx"));
            }
            //window.location.href = "https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=" + json.data.prepay_id + "&package=" + json.data.package;
        }
    });
    return;
    setTimeout(function () {
        $("#city5").picker("open");
    }, 10);
};

function isWeiXin() {
    var ua = window.navigator.userAgent.toLowerCase();
    if (ua.match(/MicroMessenger/i) == 'micromessenger') {
        return "true";
    } else {
        return "false";
    }
} 

function testApp(url) {
    var timeout, t = 1000, hasApp = true;
    setTimeout(function () {
        if (hasApp) {
            //alert('安装了app');
            $.hideLoading();
        } else {
            $.hideLoading();
            alert('未安装微信客户端');
        }
        document.body.removeChild(ifr);
    }, 5000)

    var t1 = Date.now();
    var ifr = document.createElement("iframe");
    ifr.setAttribute('src', url);
    ifr.setAttribute('style', 'display:none');
    document.body.appendChild(ifr);
    timeout = setTimeout(function () {
        var t2 = Date.now();
        if (!t1 || t2 - t1 < t + 10) {
            hasApp = false;
        } else {
            $.hideLoading();
        }
    }, t);
}


    </script>
</body>
</html>
